def get_first_heading_hash_count(md_path):
    with open(md_path, 'r', encoding='utf-8') as f:
        for line in f:
            stripped = line.lstrip()
            if stripped.startswith('#'):
                count = 0
                for char in stripped:
                    if char == '#':
                        count += 1
                    else:
                        break
                return count
    return 0  # 如果没有标题行
md_path = "D:\\hbyt\\AI智能投标\\能力组件-附件\\测试1.md"
count = get_first_heading_hash_count(md_path)
print(f"第一行标题包含的 '#' 数量为: {count}")
